#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 75;

int n, m, k, tot;
int a[N], vis[N];

void dfs(int s, int need, int sum) {
  if (need <= 0) {
    cout << m;
    exit(0);
  }
  if (sum == m) {
    dfs(1, need - 1, 0);
    return;
  }
  int i = s;
  while (i <= n) {
    if (vis[i] || sum + a[i] > m) {
      i++;
      continue;
    }
    vis[i] = 1;
    dfs(i + 1, need, sum + a[i]);
    vis[i] = 0;
    if (sum == 0) return;
    if (sum + a[i] == m) return;
    int j = i + 1;
    while (j <= n && a[j] == a[i]) j++;
    i = j;
  }
}
void check(int x) {
  if (tot % x != 0) return;
  m = x;
  k = tot / x;
  dfs(1, k, 0);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  sort(a + 1, a + n + 1, greater<int>());
  tot = accumulate(a + 1, a + n + 1, 0);
  rep(i, a[1], tot / 2) check(i);
  cout << tot;
  return 0;
}